package ingsw2.structure;

import java.util.ArrayList;
import java.util.List;

public class CompositeOrganizationalUnit implements OrganizationalUnit {

	private String name;
	
	private List<OrganizationalUnit> childOrganizationalUnit = new ArrayList<OrganizationalUnit>();
	
	/**
	 * @param name
	 */
	public CompositeOrganizationalUnit(String name) {
		this.name = name;
	}

	@Override
	public void print() {
		System.out.println("Organizational Unit: " + name);
		for (OrganizationalUnit organizationalUnit : childOrganizationalUnit){
			organizationalUnit.print();
		}
	}
	
	public void add(OrganizationalUnit organizationalUnit){
		childOrganizationalUnit.add(organizationalUnit);
	}
	
	public void remove(OrganizationalUnit organizationalUnit){
		childOrganizationalUnit.remove(organizationalUnit);
	}
	
}
